package com.linkhub.oms.admin.modules.logistic.freighttemplate.domain.vo;

import cn.hutool.core.date.DatePattern;
import com.linkhub.oms.entity.LogisticFreightTemplateEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.format.DateTimeFormatter;

/**
 * <p>
 * 物流运费模板VO
 * </p>
 *
 * @author Frank
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "物流运费模板VO", description = "物流运费模板VO")
@NoArgsConstructor
public class LogisticFreightTemplateVO implements Serializable {

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "模板名称")
    private String templateName;

    @ApiModelProperty(value = "模板生效日期")
    private String effectiveDate;

    @ApiModelProperty(value = "模板失效日期")
    private String expirationDate;

    @ApiModelProperty(value = "渠道编码")
    private String channelCode;

    @ApiModelProperty(value = "渠道中文名称")
    private String channelCName;

    @ApiModelProperty(value = "渠道英文名称")
    private String channelEName;

    @ApiModelProperty(value = "国家编码")
    private String countryCode;

    @ApiModelProperty(value = "国家分区")
    private String countryPartition;

    public LogisticFreightTemplateVO(LogisticFreightTemplateEntity entity) {
        this.id = entity.getId();
        this.templateName = entity.getTemplateName();
        this.effectiveDate = entity.getEffectiveDate().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
        this.expirationDate = entity.getExpirationDate().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
        this.channelCode = entity.getChannelCode();
        this.channelCName = entity.getChannelCName();
        this.channelEName = entity.getChannelEName();
        this.countryCode = entity.getCountryCode();
        this.countryPartition = entity.getCountryPartition();
    }
}
